import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '../layout/index.vue'

Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'Home',
        component: () => import( /* webpackChunkName: "Home"*/ '../views/Home/index.vue')
    },
    {
        path: '/redirect',
        name: 'Layout',
        component:  () => import( /* webpackChunkName: "Login"*/ '../layout/index.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component:  () => import( /* webpackChunkName: "Login"*/ '../views/Login/index.vue')
    },
    {
        path: '/echarts',
        name: 'Echarts',
        component:  () => import(/* webpackChunkName: "echarts"*/ '../views/Echarts/index.vue')
    },
    {
        path: '/profile',
        component: Layout,
        redirect: '/profile',
        hidden: true,
        children: [
          {
            path: 'index',
            component: () => import('@/views/profile/index'),
            name: 'Profile',
            meta: {
              title: '商铺列表',
              keepAlive: true
            }
          },
          {
            path: 'like',
            component: () => import('@/views/profiles/index'),
            name: 'Profiles',
            meta: {
              title: '商品列表',
              keepAlive: true
            }
          },
          {
            path: 'mine',
            component: () => import('@/views/mine/index'),
            name: 'Mine',
            meta: {
              title: '个人列表',
              keepAlive: true
            }
          }
        ]
      }
    
]
const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router